<?php

class Db
{
    static private $_instance;
    static private $_connect;

    private function __construct(){}

    public static function getInstance()
    {
        if (!self::$_instance) {
            self::$_instance = new self();
        }
        return self::$_instance;
    }

    public function connect()
    {
        self::$_connect = mysqli_connect('localhost', 'text', 'HQBBYL624', 'text');
        mysqli_set_charset(self::$_connect, 'UTF8');
        if (!self::$_connect) {
            die('connect error'.mysqli_connect_error());
        }

        return self::$_connect;
    }
}

$resource = Db::getInstance()->connect();
$result = mysqli_query($resource, 'select * from MyGuests');
echo mysqli_num_rows($result);
var_dump($resource);